home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickDraw3D 1.6 SDK / Mac Interfaces / CIncludes / RAVESystem.h < prev   
Encoding:
C/C++ Source or Header  |  1999-05-18  |  15.5 KB  |  371 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        RAVESystem.h
  3.  
  4.      Contains:    Interfaces needed when building RAVE engines                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.0
  8.  
  9.      Copyright:    © 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __RAVESYSTEM__
  18. #define __RAVESYSTEM__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23. #ifndef __RAVE__
  24. #include <RAVE.h>
  25. #endif
  26.  
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=power
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. #if PRAGMA_ENUM_ALWAYSINT
  51.     #pragma enumsalwaysint on
  52. #elif PRAGMA_ENUM_OPTIONS
  53.     #pragma option enum=int
  54. #elif PRAGMA_ENUM_PACK
  55.     #if __option(pack_enums)
  56.         #define PRAGMA_ENUM_PACK__RAVESYSTEM__
  57.     #endif
  58.     #pragma options(!pack_enums)
  59. #endif
  60.  
  61.  
  62. /************************************************************************************************
  63.  *
  64.  * Typedefs of texture/bitmap method functions provided by the drawing engine.
  65.  *
  66.  ***********************************************************************************************/
  67. /* TQAColorTableNew    parameter descriptions */
  68. /* TQAColorTableType    pixelType            Depth, color space, etc. */
  69. /* void                    *pixelData            lookup table entries in pixelType format */
  70. /* long                    transparentIndex    boolean, false means no transparency, true means index 0 is transparent */
  71. /* TQAColorTable        **newTable            (Out) Newly created TQAColorTable */
  72. typedef CALLBACK_API_C( TQAError , TQAColorTableNew )(TQAColorTableType pixelType, void *pixelData, long transparentIndex, TQAColorTable **newTable);
  73. /* TQAColorTableDelete    parameter descriptions */
  74. /* TQAColorTable        *colorTable        Previously allocated by QAColorTableNew() */
  75. typedef CALLBACK_API_C( void , TQAColorTableDelete )(TQAColorTable *colorTable);
  76. /* TQATextureNew    parameter descriptions */
  77. /*    unsigned long        flags                Mask of kQATexture_xxx flags */
  78. /*    TQAImagePixelType    pixelType            Depth, color space, etc. */
  79. /*    const TQAImage        images[]            Image(s) for texture */
  80. /*    TQATexture            **newTexture        (Out) Newly created TQATexture, or NULL on error */
  81. typedef CALLBACK_API_C( TQAError , TQATextureNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage images[], TQATexture **newTexture);
  82. /* TQATextureDetach    parameter descriptions */
  83. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  84. typedef CALLBACK_API_C( TQAError , TQATextureDetach )(TQATexture *texture);
  85. /* TQATextureDelete    parameter descriptions */
  86. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  87. typedef CALLBACK_API_C( void , TQATextureDelete )(TQATexture *texture);
  88. /* TQATextureBindColorTable    parameter descriptions */
  89. /*    TQATexture            *texture            Previously allocated by QATextureNew() */
  90. /*    TQAColorTable        *colorTable            Previously allocated by QAColorTableNew() */
  91. typedef CALLBACK_API_C( TQAError , TQATextureBindColorTable )(TQATexture *texture, TQAColorTable *colorTable);
  92. /* TQABitmapNew    parameter descriptions */
  93. /*    unsigned long        flags                Mask of kQABitmap_xxx flags */
  94. /*    TQAImagePixelType    pixelType            Depth, color space, etc. */
  95. /*    const TQAImage        *image                Image */
  96. /*    TQABitmap            **newBitmap            (Out) Newly created TQABitmap, or NULL on error */
  97. typedef CALLBACK_API_C( TQAError , TQABitmapNew )(unsigned long flags, TQAImagePixelType pixelType, const TQAImage *image, TQABitmap **newBitmap);
  98. /* TQABitmapDetach    parameter descriptions */
  99. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  100. typedef CALLBACK_API_C( TQAError , TQABitmapDetach )(TQABitmap *bitmap);
  101. /* TQABitmapDelete    parameter descriptions */
  102. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  103. typedef CALLBACK_API_C( void , TQABitmapDelete )(TQABitmap *bitmap);
  104. /* TQABitmapBindColorTable    parameter descriptions */
  105. /*    TQABitmap            *bitmap            Previously allocated by QABitmapNew() */
  106. /*    TQAColorTable        *colorTable        Previously allocated by QAColorTableNew() */
  107. typedef CALLBACK_API_C( TQAError , TQABitmapBindColorTable )(TQABitmap *bitmap, TQAColorTable *colorTable);
  108. /************************************************************************************************
  109.  *
  110.  * Typedefs of private (system-only) functions provided by the drawing engine.
  111.  *
  112.  * The TQADrawPrivateNew function returns a TQADrawPrivate *, which points to the
  113.  * engine-specific private data created for the context. (TQADrawPrivate is a dummy
  114.  * type which is then cast to the correct engine-specific datatype by the engine code.)
  115.  *
  116.  * The TQADrawPrivateDelete function deletes the engine-specific private data.
  117.  *
  118.  * TQAStorePrivateNew and TQAStorePrivateDelete provide the same function as QADrawPrivateNew
  119.  * and TQADrawPrivateDelete, but for the texture and bitmap storage context.
  120.  *
  121.  * TQADrawMethodGet and TQAStoreMethodGet are called by the RAVE manager to retrieve
  122.  * the method pointers for a drawing engine.
  123.  *
  124.  * The TQAEngineCheckDevice function returns TRUE if the engine can render to the
  125.  * indicated GDevice.
  126.  *
  127.  ***********************************************************************************************/
  128. /* TQADrawPrivateNew    parameter descriptions */
  129. /*    TQADrawContext        *newDrawContext        Draw context to initialize */
  130. /*    const TQADevice        *device                Target device */
  131. /*    const TQARect        *rect                Target rectangle (device coordinates) */
  132. /*    const TQAClip        *clip                2D clip region (or NULL) */
  133. /*    unsigned long        flags                Mask of kQAContext_xxx */
  134. typedef CALLBACK_API_C( TQAError , TQADrawPrivateNew )(TQADrawContext *newDrawContext, const TQADevice *device, const TQARect *rect, const TQAClip *clip, unsigned long flags);
  135. /* TQADrawPrivateDelete    parameter descriptions */
  136. /*    TQADrawPrivate        *drawPrivate        Private context data to delete */
  137. typedef CALLBACK_API_C( void , TQADrawPrivateDelete )(TQADrawPrivate *drawPrivate);
  138. /* TQAEngineCheckDevice    parameter descriptions */
  139. /*    const TQADevice        *device            Target device */
  140. typedef CALLBACK_API_C( TQAError , TQAEngineCheckDevice )(const TQADevice *device);
  141. /* TQAEngineGestalt    parameter descriptions */
  142. /*    TQAGestaltSelector    selector            Gestalt parameter being requested */
  143. /*    void                *response            Buffer that receives response */
  144. typedef CALLBACK_API_C( TQAError , TQAEngineGestalt )(TQAGestaltSelector selector, void *response);
  145.  
  146. /* new engine methods for RAVE 1.6 */
  147. typedef CALLBACK_API_C( TQAError , TQAAccessTexture )(TQATexture *texture, long mipmapLevel, long flags, TQAPixelBuffer *buffer);
  148. typedef CALLBACK_API_C( TQAError , TQAAccessTextureEnd )(TQATexture *texture, const TQARect *dirtyRect);
  149. typedef CALLBACK_API_C( TQAError , TQAAccessBitmap )(TQABitmap *bitmap, long flags, TQAPixelBuffer *buffer);
  150. typedef CALLBACK_API_C( TQAError , TQAAccessBitmapEnd )(TQABitmap *bitmap, const TQARect *dirtyRect);
  151. /************************************************************************************************
  152.  *
  153.  * The TQAEngineMethod union is used to represent a single engine method (it's a
  154.  * parameter to QAEngineGetMethod). TQAEngineMethodTag identifies which method is being
  155.  * requested.
  156.  *
  157.  ***********************************************************************************************/
  158.  
  159. union TQAEngineMethod {
  160.     TQADrawPrivateNew                 drawPrivateNew;                /* Method: Create a private draw context */
  161.     TQADrawPrivateDelete             drawPrivateDelete;            /* Method: Delete a private draw context */
  162.     TQAEngineCheckDevice             engineCheckDevice;            /* Method: Check a device for drawing */
  163.     TQAEngineGestalt                 engineGestalt;                /* Method: Gestalt */
  164.     TQATextureNew                     textureNew;                    /* Method: Create a texture (load is non-blocking) */
  165.     TQATextureDetach                 textureDetach;                /* Method: Complete load of a texture (blocking) */
  166.     TQATextureDelete                 textureDelete;                /* Method: Delete a texture */
  167.     TQABitmapNew                     bitmapNew;                    /* Method: Create a bitmap (load is non-blocking)  */
  168.     TQABitmapDetach                 bitmapDetach;                /* Method: Complete load of a bitmap (blocking) */
  169.     TQABitmapDelete                 bitmapDelete;                /* Method: Delete a bitmap */
  170.     TQAColorTableNew                 colorTableNew;                /* Method: Create a new color table */
  171.     TQAColorTableDelete             colorTableDelete;            /* Method: Create a new color table */
  172.     TQATextureBindColorTable         textureBindColorTable;        /* Method: Bind a CLUT to a texture */
  173.     TQABitmapBindColorTable         bitmapBindColorTable;        /* Method: Bind a CLUT to a bitmap */
  174.     TQAAccessTexture                 accessTexture;
  175.     TQAAccessTextureEnd             accessTextureEnd;
  176.     TQAAccessBitmap                 accessBitmap;
  177.     TQAAccessBitmapEnd                 accessBitmapEnd;
  178. };
  179. typedef union TQAEngineMethod            TQAEngineMethod;
  180.  
  181. enum TQAEngineMethodTag {
  182.     kQADrawPrivateNew            = 0,
  183.     kQADrawPrivateDelete        = 1,
  184.     kQAEngineCheckDevice        = 2,
  185.     kQAEngineGestalt            = 3,
  186.     kQATextureNew                = 4,
  187.     kQATextureDetach            = 5,
  188.     kQATextureDelete            = 6,
  189.     kQABitmapNew                = 7,
  190.     kQABitmapDetach                = 8,
  191.     kQABitmapDelete                = 9,
  192.     kQAColorTableNew            = 10,
  193.     kQAColorTableDelete            = 11,
  194.     kQATextureBindColorTable    = 12,
  195.     kQABitmapBindColorTable        = 13,
  196.     kQAAccessTexture            = 14,
  197.     kQAAccessTextureEnd            = 15,
  198.     kQAAccessBitmap                = 16,
  199.     kQAAccessBitmapEnd            = 17
  200. };
  201. typedef enum TQAEngineMethodTag TQAEngineMethodTag;
  202.  
  203. /************************************************************************************************
  204.  *
  205.  * QARegisterEngine() registers a new engine. This is called at boot time by the drawing engine
  206.  * initialization code to register itself with the system. This call takes only one parameter,
  207.  * the engine's function that allows the manager to request the other methods.
  208.  *
  209.  ***********************************************************************************************/
  210. /* TQAEngineGetMethod    parameter descriptions */
  211. /*    TQAEngineMethodTag        methodTag                Method being requested */
  212. /*    TQAEngineMethod            *method                    (Out) Method */
  213. typedef CALLBACK_API_C( TQAError , TQAEngineGetMethod )(TQAEngineMethodTag methodTag, TQAEngineMethod *method);
  214. /* QARegisterEngine    parameter descriptions */
  215. /*    TQAEngineGetMethod        engineGetMethod        Engine's getMethod method */
  216. EXTERN_API_C( TQAError )
  217. QARegisterEngine                (TQAEngineGetMethod     engineGetMethod);
  218.  
  219.  
  220. /* QARegisterEngineWithRefCon parameter descriptions */
  221. /*    TQAEngineGetMethod        engineGetMethod        Engine's getMethod method */
  222. /*  long                    refCon                Engine RefCon */
  223. EXTERN_API_C( TQAError )
  224. QARegisterEngineWithRefCon        (TQAEngineGetMethod     engineGetMethod,
  225.                                  long                     refCon);
  226.  
  227. /* QAGetEngineRefCon parameter descriptions */
  228. EXTERN_API_C( long )
  229. QAGetCurrentEngineRefCon        (void);
  230.  
  231.  
  232. /************************************************************************************************
  233.  *
  234.  * The TQADrawMethod union is used to represent a single draw context method (it's a
  235.  * parameter to QARegisterDrawMethod). TQADrawMethodTag identifies which method is being
  236.  * passed.
  237.  *
  238.  ***********************************************************************************************/
  239.  
  240. union TQADrawMethod {
  241.     TQASetFloat                     setFloat;                    /* Method: Set a float state variable */
  242.     TQASetInt                         setInt;                        /* Method: Set an unsigned long state variable */
  243.     TQASetPtr                         setPtr;                        /* Method: Set an unsigned long state variable */
  244.     TQAGetFloat                     getFloat;                    /* Method: Get a float state variable */
  245.     TQAGetInt                         getInt;                        /* Method: Get an unsigned long state variable */
  246.     TQAGetPtr                         getPtr;                        /* Method: Get an pointer state variable */
  247.     TQADrawPoint                     drawPoint;                    /* Method: Draw a point */
  248.     TQADrawLine                     drawLine;                    /* Method: Draw a line */
  249.     TQADrawTriGouraud                 drawTriGouraud;                /* Method: Draw a Gouraud shaded triangle */
  250.     TQADrawTriTexture                 drawTriTexture;                /* Method: Draw a texture mapped triangle */
  251.     TQADrawVGouraud                 drawVGouraud;                /* Method: Draw Gouraud vertices */
  252.     TQADrawVTexture                 drawVTexture;                /* Method: Draw texture vertices */
  253.     TQADrawBitmap                     drawBitmap;                    /* Method: Draw a bitmap */
  254.     TQARenderStart                     renderStart;                /* Method: Initialize for rendering */
  255.     TQARenderEnd                     renderEnd;                    /* Method: Complete rendering and display */
  256.     TQARenderAbort                     renderAbort;                /* Method: Abort any outstanding rendering (blocking) */
  257.     TQAFlush                         flush;                        /* Method: Start render of any queued commands (non-blocking) */
  258.     TQASync                         sync;                        /* Method: Wait for completion of all rendering (blocking) */
  259.     TQASubmitVerticesGouraud         submitVerticesGouraud;        /* Method: Submit Gouraud vertices for trimesh */
  260.     TQASubmitVerticesTexture         submitVerticesTexture;        /* Method: Submit Texture vertices for trimesh */
  261.     TQADrawTriMeshGouraud             drawTriMeshGouraud;            /* Method: Draw a Gouraud triangle mesh */
  262.     TQADrawTriMeshTexture             drawTriMeshTexture;            /* Method: Draw a Texture triangle mesh */
  263.     TQASetNoticeMethod                 setNoticeMethod;            /* Method: Set a notice method */
  264.     TQAGetNoticeMethod                 getNoticeMethod;            /* Method: Get a notice method */
  265.  
  266.                                                                 /* new in 1.6 */
  267.     TQASubmitMultiTextureParams     submitMultiTextureParams;    /* Method: Submit secondary texture params */
  268.     TQAAccessDrawBuffer             accessDrawBuffer;
  269.     TQAAccessDrawBufferEnd             accessDrawBufferEnd;
  270.     TQAAccessZBuffer                 accessZBuffer;
  271.     TQAAccessZBufferEnd             accessZBufferEnd;
  272.     TQAClearDrawBuffer                 clearDrawBuffer;
  273.     TQAClearZBuffer                 clearZBuffer;
  274.     TQATextureNewFromDrawContext     textureFromContext;
  275.     TQABitmapNewFromDrawContext     bitmapFromContext;
  276.     TQABusy                         busy;
  277.     TQASwapBuffers                     swapBuffers;
  278. };
  279. typedef union TQADrawMethod                TQADrawMethod;
  280.  
  281. enum TQADrawMethodTag {
  282.     kQASetFloat                    = 0,
  283.     kQASetInt                    = 1,
  284.     kQASetPtr                    = 2,
  285.     kQAGetFloat                    = 3,
  286.     kQAGetInt                    = 4,
  287.     kQAGetPtr                    = 5,
  288.     kQADrawPoint                = 6,
  289.     kQADrawLine                    = 7,
  290.     kQADrawTriGouraud            = 8,
  291.     kQADrawTriTexture            = 9,
  292.     kQADrawVGouraud                = 10,
  293.     kQADrawVTexture                = 11,
  294.     kQADrawBitmap                = 12,
  295.     kQARenderStart                = 13,
  296.     kQARenderEnd                = 14,
  297.     kQARenderAbort                = 15,
  298.     kQAFlush                    = 16,
  299.     kQASync                        = 17,
  300.     kQASubmitVerticesGouraud    = 18,
  301.     kQASubmitVerticesTexture    = 19,
  302.     kQADrawTriMeshGouraud        = 20,
  303.     kQADrawTriMeshTexture        = 21,
  304.     kQASetNoticeMethod            = 22,
  305.     kQAGetNoticeMethod            = 23,
  306.     kQSubmitMultiTextureParams    = 24,
  307.     kQAccessDrawBuffer            = 25,
  308.     kQAccessDrawBufferEnd        = 26,
  309.     kQAccessZBuffer                = 27,
  310.     kQAccessZBufferEnd            = 28,
  311.     kQClearDrawBuffer            = 29,
  312.     kQClearZBuffer                = 30,
  313.     kQTextureNewFromDrawContext    = 31,
  314.     kQBitmapNewFromDrawContext    = 32,
  315.     kQBusy                        = 33,
  316.     kQSwapBuffers                = 34
  317. };
  318. typedef enum TQADrawMethodTag TQADrawMethodTag;
  319.  
  320. /************************************************************************************************
  321.  *
  322.  * System call to register a new method for an engine. This is called during the engine's
  323.  * draw private new functions (to set the initial value of the draw methods), and possibly
  324.  * at other times when the engine needs to change a draw method.
  325.  *
  326.  ***********************************************************************************************/
  327. /* QARegisterDrawMethod    parameter descriptions */
  328. /*    TQADrawContext            *drawContext            Draw context in which to set method */
  329. /*    TQADrawMethodTag        methodTag                Method to set */
  330. /*    TQADrawMethod            method                    Method */
  331. EXTERN_API_C( TQAError )
  332. QARegisterDrawMethod            (TQADrawContext *        drawContext,
  333.                                  TQADrawMethodTag         methodTag,
  334.                                  TQADrawMethod             method);
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343. #if PRAGMA_ENUM_ALWAYSINT
  344.     #pragma enumsalwaysint reset
  345. #elif PRAGMA_ENUM_OPTIONS
  346.     #pragma option enum=reset
  347. #elif defined(PRAGMA_ENUM_PACK__RAVESYSTEM__)
  348.     #pragma options(pack_enums)
  349. #endif
  350.  
  351. #if PRAGMA_STRUCT_ALIGN
  352.     #pragma options align=reset
  353. #elif PRAGMA_STRUCT_PACKPUSH
  354.     #pragma pack(pop)
  355. #elif PRAGMA_STRUCT_PACK
  356.     #pragma pack()
  357. #endif
  358.  
  359. #ifdef PRAGMA_IMPORT_OFF
  360. #pragma import off
  361. #elif PRAGMA_IMPORT
  362. #pragma import reset
  363. #endif
  364.  
  365. #ifdef __cplusplus
  366. }
  367. #endif
  368.  
  369. #endif /* __RAVESYSTEM__ */
  370.  
  371.